package scriptNotify

import (
	"gitee.com/fierce_wolf/go-fox-edge-common/commEntity"
	"gitee.com/fierce_wolf/go-fox-edge-common/edgeEntity"
	"go-fox-edge-channel-mqtt-client/scriptEngine"
)

type operateEntityTypeNotify struct {
}

func (e *operateEntityTypeNotify) Notify(updateTime int64, addMap map[string]commEntity.IEntity, delSet map[string]commEntity.IEntity, mdyMap map[string]commEntity.IEntity) {
	for _, entity := range addMap {
		e.rebindScriptEngine(entity)
	}
	for _, entity := range mdyMap {
		e.rebindScriptEngine(entity)
	}
}

func (e *operateEntityTypeNotify) rebindScriptEngine(entity commEntity.IEntity) {
	operateEntity := entity.(*edgeEntity.OperateEntity)

	scriptEngine.RebindScriptEngine(operateEntity)
}
